home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / Programs / Ipswitch.IMail.Server.Pro.8.0.Winall / IMail8ec.exe / data1.cab / Web_Calendar / functions.cgi < prev    next >
Encoding:
Text File  |  2003-05-07  |  10.0 KB  |  398 lines

  1.     //var args = parseQueryString();
  2.     var result;
  3.     var boxStyle;
  4.     var boxStyle2;
  5.     var arr_Month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  6.     var dayNum = <!--ICAL.ToDayMonthName-->;
  7.     var newday = parseFloat("<!--ICAL.TodayDay-->");
  8.         
  9.     //(args['side'] == 1)?result=1:result=0;
  10.  
  11.     //if(result==1)
  12.     //{
  13.     //  boxStyle2='block'; 
  14.     //  boxStyle='none';
  15.     //}
  16.     //else
  17.     //{
  18.     //  boxStyle2='none';
  19.     //  boxStyle='block';
  20.     //}
  21.  
  22.  
  23.   if (document.layers)
  24.   {
  25.     document.captureEvents(Event.DBLCLICK);
  26.   }
  27.  
  28.   document.ondblclick = function (evt)
  29.   {
  30.     var tarX;
  31.     var tarY;
  32.     var showIt;
  33.     var target;
  34.     var moveableMenu;
  35.     var theScreenWidth;
  36.     var theScreenHeight;
  37.     var divWidth;
  38.     var divHeight;
  39.     var myHeight;
  40.  
  41.     if(document.all)
  42.     {
  43.       tarX = event.clientX;
  44.       tarY = event.clientY;
  45.       showIt = 'visible';
  46.       hideIt = 'hidden';
  47.       target = event.srcElement;
  48.       moveableMenu = boxMe.style;
  49.       theScreenWidth = document.body.clientWidth;
  50.       theScreenHeight = document.body.clientHeight
  51.       divWidth = boxMe.clientWidth;
  52.       divHeight = boxMe.clientHeight;
  53.     }
  54.     
  55.     if (document.layers)
  56.     {
  57.       tarX = evt.pageX;
  58.       tarY = evt.pageY;
  59.       showIt = 'show';
  60.       hideIt = 'hide';
  61.       target = evt.target;
  62.       moveableMenu = document.boxMe;
  63.       theScreenWidth = self.innerWidth;
  64.       theScreenHeight = self.innerHeight;
  65.       divWidth = moveableMenu.clip.width;
  66.       divHeight = moveableMenu.clip.height;
  67.     }
  68.  
  69.     if(document.all)
  70.     {
  71.       var el = invisibleBox
  72.       var ot = el.offsetTop;
  73.       while((el = el.offsetParent) != null)
  74.       {
  75.         ot += el.offsetTop;
  76.       }
  77.       myHeight = ot;
  78.       if(myHeight>tarY)
  79.       {
  80.         tarY = myHeight;
  81.       }
  82.     }
  83.     if(document.layers)
  84.     {
  85.       myHeight = document.invisibleBox.pageY;
  86.       if(myHeight>tarY)
  87.       {
  88.         tarY = myHeight;
  89.       }
  90.     }
  91.     
  92.     //alert("The height is: " + myHeight + ", mouse clicked at: " + tarY);
  93.     
  94.     //alert("X = " + event.clientX + ", Y = " + event.clientY);
  95.     //alert("height="+ divHeight + ", width=" + divWidth);
  96.     //alert("The mouse clicked at:\n height: " + tarY + "\n width: " + tarX + "\n\n Screen height="+ theScreenHeight + "\n Screen width=" + theScreenWidth);
  97.  
  98.  
  99.     if (moveableMenu.display=="block")
  100.     {
  101.       moveableMenu.visibility = hideIt;
  102.       moveableMenu.display='none';
  103.     }
  104.     else
  105.     {
  106.       moveableMenu.visibility = showIt;
  107.       moveableMenu.display = 'block';
  108.     }
  109.  
  110.  
  111.     if(((tarX + divWidth) < theScreenWidth)|| ((tarX - divWidth)<0))
  112.     {
  113.       moveableMenu.left=tarX;
  114.     }
  115.     else
  116.     {
  117.       moveableMenu.left=tarX - divWidth;
  118.     }
  119.     
  120.     if(((tarY + divHeight) < theScreenHeight)|| ((tarY - divHeight)<=myHeight))
  121.     {
  122.       moveableMenu.top=tarY;
  123.     }
  124.     else
  125.     {
  126.       moveableMenu.top=tarY - divHeight;
  127.     }
  128.  
  129.     return true;
  130.   };
  131.  
  132.   function openMenu()
  133.   {
  134.     var showIt;
  135.     var moveableMenu;
  136.     var myHeight;
  137.  
  138.     if(document.all)
  139.     {
  140.       var el = invisibleBox
  141.       var ot = el.offsetTop;
  142.       while((el = el.offsetParent) != null)
  143.       {
  144.         ot += el.offsetTop;
  145.       }
  146.       myHeight = ot;
  147.     }
  148.     if(document.layers)
  149.     {
  150.       myHeight = document.invisibleBox.pageY;
  151.     }
  152.  
  153.     if(document.all)
  154.     {
  155.       showIt = 'visible';
  156.       hideIt = 'hidden';
  157.       moveableMenu = boxMe.style;
  158.     }
  159.     
  160.     if (document.layers)
  161.     {
  162.       showIt = 'show';
  163.       hideIt = 'hide';
  164.       moveableMenu = document.boxMe;
  165.     }
  166.  
  167.     if (moveableMenu.display=="block")
  168.     {
  169.       moveableMenu.visibility = hideIt;
  170.       moveableMenu.display='none';
  171.     }
  172.     else
  173.     {
  174.       moveableMenu.visibility = showIt;
  175.       moveableMenu.display = 'block';
  176.       moveableMenu.left = 8;
  177.       moveableMenu.top = myHeight;
  178.     }
  179.  
  180.     return;
  181.   }
  182.  
  183.  
  184.  
  185.   function closeMenu()
  186.   {
  187.     var showIt;
  188.     var moveableMenu;
  189.  
  190.     if(document.all)
  191.     {
  192.       showIt = 'visible';
  193.       hideIt = 'hidden';
  194.       moveableMenu = boxMe.style;
  195.     }
  196.     
  197.     if (document.layers)
  198.     {
  199.       showIt = 'show';
  200.       hideIt = 'hide';
  201.       moveableMenu = document.boxMe;
  202.     }
  203.  
  204.     if (moveableMenu.display=="block")
  205.     {
  206.       moveableMenu.visibility = hideIt;
  207.       moveableMenu.display='none';
  208.     }
  209.     else
  210.     {
  211.       moveableMenu.visibility = hideIt;
  212.       moveableMenu.display = 'none';
  213.     }
  214.  
  215.     return;
  216.   }
  217.  
  218.   <!-- Function to Go To the selected date -->
  219.   function sendDate()
  220.   {
  221.     var iDay,iMonth,iYear;
  222.     iDay = document.forms[0].GoToDay.selectedIndex;
  223.     iMonth = document.forms[0].GoToMonth.selectedIndex;
  224.     iYear = document.forms[0].GoToYear.selectedIndex;
  225.     
  226.     document.forms[0].UI_Date.value= document.forms[0].GoToYear.options[iYear].value+document.forms[0].GoToMonth.options[iMonth].value+document.forms[0].GoToDay.options[iDay].value;
  227.     document.forms[0].UI_CurrentView.value = "DAILY";
  228.     document.forms[0].action = "DAILYVIEW.<!--ICAL.Number-->.cgi";
  229.     document.forms[0].submit();
  230.   }
  231.  
  232.   <!--Function For Search -->
  233.   function searchString()
  234.   {
  235.     var iDay,iMonth,iYear;
  236.     
  237.     iDay = document.forms[0].GoToDay.selectedIndex;
  238.     iMonth = document.forms[0].GoToMonth.selectedIndex;
  239.     iYear = document.forms[0].GoToYear.selectedIndex;
  240.                 
  241.     document.forms[0].UI_Date.value= document.forms[0].GoToYear.options[iYear].value+document.forms[0].GoToMonth.options[iMonth].value+document.forms[0].GoToDay.options[iDay].value;
  242.     document.forms[0].UI_CurrentView.value = "<!--ICAL.CurrentView-->";//"SEARCHRESULT";    
  243.  
  244.     document.forms[0].action = "SEARCHRESULT.<!--ICAL.Number-->.cgi"
  245.     document.forms[0].submit();
  246.   }
  247.     
  248.   <!-- Function to set the current date -->
  249.   function setDate()
  250.   {
  251.     //if(boxStyle=='none')
  252.     //{
  253.     //  return;
  254.     //}
  255.  
  256.  
  257.     var tDay,lenDay,tMonth,lenMonth,tYear,lenYear,toDay;
  258.     tDay = parseFloat("<!--ICAL.UserDay-->")-1;
  259.     tMonth = parseFloat("<!--ICAL.UserMonth-->") - 1;
  260.     tYear = parseFloat("<!--ICAL.UserYear-->");
  261.     lenDay = document.forms[0].GoToDay.length;
  262.     lenMonth = document.forms[0].GoToMonth.length;
  263.     lenYear = document.forms[0].GoToYear.length;
  264.  
  265.  
  266.     document.forms[0].GoToDay.options[tDay].selected = true;
  267.     document.forms[0].GoToMonth.options[tMonth].selected = true;
  268.     for(i=0; i < lenYear; i++)
  269.     {
  270.       if(document.forms[0].GoToYear.options[i].value == tYear)
  271.       {
  272.         document.forms[0].GoToYear.options[i].selected = true;
  273.       }
  274.     }
  275.   }
  276.  
  277.  
  278.   <!-- Function to validate the search string -->
  279.   function chkSearchString()
  280.   {
  281.     var tmp_string = document.forms[0].UI_Search.value;
  282.     if(tmp_string == "" || tmp_string.length == 0)
  283.     {
  284.       alert("Please enter title to search!");
  285.       document.forms[0].UI_Search.focus();
  286.     }
  287.     else if(tmp_string.length > 80)
  288.     {
  289.       alert("Title should be less than 80 characters!");
  290.       document.forms[0].UI_Search.focus();
  291.     }
  292.     else
  293.     {
  294.       searchString();
  295.     }
  296.   }
  297.             
  298.   <!-- Function to validate the search string for Enter Pressed -->
  299.   function chkSearchStringEnter()
  300.   {
  301.     
  302.     var tmp_string = document.forms[0].UI_Search.value;
  303.     if(tmp_string == "" || tmp_string.length == 0)
  304.     {
  305.       alert("Please enter title to search!");
  306.       document.forms[0].UI_Search.focus();
  307.       return; 
  308.     }
  309.     else if(tmp_string.length > 80)
  310.     {
  311.       alert("Title should be less than 80 characters!");
  312.       document.forms[0].UI_Search.focus();
  313.       return;
  314.     }
  315.     else
  316.     {
  317.       searchString();
  318.     }
  319.   }
  320.  
  321.   function OpenIcal()
  322.   { 
  323.     var link;
  324.     <!--ICAL.BeginSSL-->
  325.         <!--ICAL.BeginIfCurrentDomainIsAVirtualDomain-->
  326.             link = "https://<!--ICAL.PrimaryDomain-->:<!--ICAL.ImailSSLServerPort-->/ical.cgi?&App=IWebMsg&<!--ICAL.UserParameters-->";
  327.             open(link,"iwebmsg", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=0,width=512,height=512");
  328.         <!--ICAL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
  329.             link = "https://<!--ICAL.CurrentDomain-->:<!--ICAL.ImailSSLServerPort-->/ical.cgi?&App=IWebMsg&<!--ICAL.UserParameters-->";
  330.             open(link,"iwebmsg", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=0,width=512,height=512");
  331.         <!--ICAL.EndBeginIfCurrentDomainIsAVirtualDomain-->
  332.     <!--ICAL.ElseBeginSSL-->
  333.         <!--ICAL.BeginIfCurrentDomainIsAVirtualDomain-->
  334.             link = "http://<!--ICAL.PrimaryDomain-->:<!--ICAL.ImailServerPort-->/ical.cgi?&App=IWebMsg&<!--ICAL.UserParameters-->";
  335.             open(link,"iwebmsg", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=0,width=512,height=512");
  336.         <!--ICAL.ElseBeginIfCurrentDomainIsAVirtualDomain-->
  337.             link = "http://<!--ICAL.CurrentDomain-->:<!--ICAL.ImailServerPort-->/ical.cgi?&App=IWebMsg&<!--ICAL.UserParameters-->";
  338.             open(link,"iwebmsg", "toolbar=yes,location=1,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=1,copyhistory=0,width=512,height=512");
  339.         <!--ICAL.EndBeginIfCurrentDomainIsAVirtualDomain-->
  340.     <!--ICAL.EndBeginSSL-->
  341.   }
  342.  
  343.  
  344.   //function parseQueryString (str) 
  345.   //{  
  346.   //  str = str ? str : location.search;
  347.   //  var query = str.charAt(0) == '?' ? str.substring(1) : str;
  348.   //  var args = new Object();  
  349.   //  if (query)
  350.   //  {
  351.   //    var fields = query.split('&');
  352.   //    for (var f = 0; f < fields.length; f++)
  353.   //  {
  354.   //      var field = fields[f].split('=');
  355.   //      args[unescape(field[0].replace(/\+/g, ' '))] = unescape(field[1].replace(/\+/g, ' '));
  356.   //  }
  357.   //  }
  358.   //  return args;
  359.   //}
  360.  
  361. //---------------- Function to create the list of year -------------------
  362. function getYearList()
  363. {
  364.     var s_year, e_year;
  365.     s_year = 1970;  // <!--ICAL.StartYear-->;
  366.     e_year = 2037;  // <!--ICAL.EndYear-->;
  367.     for (;s_year <= e_year; s_year++) 
  368.     {
  369.         document.write("<OPTION VALUE="+s_year+">"+s_year+"</OPTION>");
  370.     }
  371. }
  372.  
  373. //---------------- Function to create the list of month ------------------
  374. var arrMonth = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
  375. function getMonthList()
  376. {
  377.     for(i=0; i<arrMonth.length; i++)
  378.     {
  379.         var j = i + 1;
  380.         if(j<10)
  381.             document.write("<OPTION VALUE= 0"+j+">"+arrMonth[i]+"</OPTION>");
  382.         else
  383.             document.write("<OPTION VALUE="+j+">"+arrMonth[i]+"</OPTION>");
  384.     }
  385. }
  386.  
  387. //---------------- Function to create the list of days -------------------
  388. function getDaysList()
  389. {
  390.     for (i=0; i<31; i++)
  391.     {
  392.         var j = i + 1;
  393.         if(j<10)
  394.             document.write("<OPTION VALUE= 0"+j+">"+j+"</OPTION>");
  395.         else
  396.             document.write("<OPTION VALUE="+j+">"+j+"</OPTION>");
  397.     }
  398. }